<template>
  <view
    @click="onClick"
    class="my-search-container"
    :style="{ backgroundColor: bgColor }"
  >
    <!-- 这是一个没有输入功能的假输入框，点击后直接跳转到单独的搜索页面-->
    <view class="my-search-box" :style="{ 'border-radius': bdRadius }">
      <uni-icons type="search" size="17"></uni-icons>
      <text class="placeholder">{{ tipWord }}</text>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    // 1. 背景颜色
    bgColor: {
      type: String,
      default: "#c00000",
    },
    // 2. 圆角控制
    bdRadius: {
      type: String,
      default: "30rpx",
    },
    // 3. 提示文字
    tipWord: {
      type: String,
      default: "搜索想要的商品",
    },
  },
  methods: {
    onClick() {
      // console.log("子组件内部触发了点击事件");
      this.$emit("click");
    },
  },
};
</script>

<style scoped lang="scss">
.my-search-container {
  // background-color: #c00000;
  height: 100rpx;
  padding: 0 20rpx;
  display: flex;
  align-items: center;
}

.my-search-box {
  height: 72rpx;
  background-color: #ffffff;
  // border-radius: 30rpx;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;

  .placeholder {
    font-size: 30rpx;
    margin-left: 10rpx;
  }
}
</style>
